<template>
    <div class="select-ctrl">
        <ul class="list tool">
            <li :class="['tool-item']" @click="initSelect">选择</li>
        </ul>
    </div>
</template>

<script>
import olMap from '../../util/lmap/lmap.js' // 引入地图包对象
import { mapState } from 'vuex'
export default {
    data() {
        return {
            select: null,
            type: ''
        }
    },
    computed: {
        ...mapState({
            map: (state) => state.map
        })
    },
    methods: {
        // 初始化绘制对象
        initSelect() {
            if (this.select) {
                // this.endDraw()
            }
            let style = {
                isIcon: false,
                stroke: {
                    color: '#aaff7f',
                    width: 2
                },
                fill: {
                    color: 'rgba(255, 255, 127, 0.6)'
                },
                icon: {
                    radius: 50,
                    stroke: {
                        color: '#0000ff',
                        width: 2
                    },
                    fill: {
                        color: 'rgba(255, 255, 127, 0.6)'
                    }
                }
            }
            olMap.draw.initSelect(olMap.map.getLayers().array_, style)
            olMap.draw.startSelect(olMap.map, function (e) {
                console.log('选择回调', e)
            })
        }
    }
}
</script>

<style></style>
